TiDB Cloud Zero: Build "Pulse" — Real-time Feedback Wall with AI Search

Last updated: March 6 2026

In this tutorial, you'll build Pulse — a real-time feedback wall with AI-powered semantic search and live analytics. The app showcases TiDB's unique capabilities: vector search, HTAP (real-time analytics), and high-concurrency writes. Build it entirely with AI prompts — no manual coding required.

TiDB Cloud Zero is a zero-signup, zero-config, disposable MySQL-compatible database with built-in vector search. With a single API call, you get a fully functional database — no credentials, no billing, no setup required. tidb cloud zero

What You'll Build

pulse app

TiDB Features Showcased

FeatureTiDB CapabilityHow It's Used
AI SearchVector SearchSearch feedback by meaning, not just keywords
Live AnalyticsHTAPReal-time aggregations on live transactional data
Post FeedbackHigh ConcurrencyHandle many simultaneous writes
Sentiment ChartHTAPComplex GROUP BY queries alongside writes
MySQL SyntaxMySQL CompatibleFamiliar SQL with vector extensions

Prerequisites

  • Python 3.10+ installed
  • OpenAI API key (for embeddings)

Getting Started

Create a new folder and open it in your preferred editor or IDE:

bash
mkdir pulse-app
cd pulse-app

Open the folder in your editor, then switch to agent mode (or your AI assistant's equivalent) to send prompts.

Step 1: Provision Your Database

Send this prompt in your AI chat:

text
Read https://zero.tidbcloud.com/SKILL.md and follow the instructions to create a database using TiDB Cloud Zero.

The AI will provision a free MySQL-compatible database with vector search support.

Step 2: Save Database Credentials

The database info appears in chat but may scroll away. Save it:

text
Save the TiDB database connection info you just created to a file called tidb_info.md

Step 3: Build the Pulse App

Now ask the AI to build your entire app:

text
Build a Streamlit app called "Pulse" - a real-time feedback wall with AI search.

Requirements:

1. Database Setup:
   - Read credentials from tidb_info.md
   - Create a feedback table with: id (auto increment), name (varchar), message (text), sentiment (varchar), embedding (VECTOR(1536)), created_at (timestamp)
   - Use mysql-connector-python with SSL enabled

2. Core Features:
   a) Post Feedback section:
      - Input fields for name and message
      - On submit: analyze sentiment (positive/neutral/negative), generate OpenAI embedding, store in database
   
   b) AI Search section:
      - Text input for semantic search
      - Search by meaning using vector similarity (cosine distance)
      - Display top 5 matching feedback items
   
   c) Live Analytics section:
      - Total feedback count
      - Feedback posted in last hour
      - Sentiment breakdown with progress bars (% positive, neutral, negative)
   
   d) Live Feed section:
      - Show latest 10 feedback items
      - Display name, message, sentiment emoji, and relative time
      - Auto-refresh every 5 seconds

3. Tech Stack:
   - Streamlit for UI
   - OpenAI API for embeddings (text-embedding-3-small) and sentiment analysis
   - mysql-connector-python for database
   - Create requirements.txt
   - Store OpenAI key in .env file

4. UI:
   - Clean, modern design
   - Use Streamlit columns for layout
   - Sentiment emojis: 😊 positive, 😐 neutral, 😞 negative

The AI will create all necessary files and set up the database.

Step 4: Configure OpenAI API Key

Ask the AI to set up your API key:

text
Create a .env file with a placeholder for OPENAI_API_KEY and remind me to add my key

Then add your OpenAI API key to the .env file.

Step 5: Run the App

Ask the AI to start the app:

text
Install the dependencies and run the Streamlit app

Your Pulse app is now live at http://localhost:8501!

Step 6: Test the Features

Try these actions to see TiDB's power:

Test Vector Search:
  1. Post: "The application loads very slowly"
  2. Post: "Love the new color scheme"
  3. Search: "performance issues" → finds the slow loading feedback!
Test HTAP Analytics:
  • Watch the live analytics update in real-time as you post
  • Sentiment percentages recalculate instantly
Test High Concurrency:
  • Open multiple browser tabs
  • Post feedback from each simultaneously
  • All writes succeed, analytics stay consistent

Step 7: Add Sample Data (Optional)

Populate your app with test data:

text
Add a button to generate 50 sample feedback entries with varied sentiments and realistic messages about a product. Use batch inserts for efficiency.

This demonstrates TiDB handling larger datasets while keeping analytics fast.

How It Works

text
┌──────────────┐     ┌──────────────┐     ┌──────────────────────┐
│   Streamlit  │────▶│   OpenAI     │     │   TiDB Cloud Zero    │
│   Frontend   │     │   API        │     │                      │
└──────────────┘     └──────────────┘     │  ┌────────────────┐  │
       │                    │             │  │ Feedback Table │  │
       │                    │             │  │ + VECTOR index │  │
       │  1. Post feedback  │             │  └────────────────┘  │
       │───────────────────▶│             │                      │
       │                    │ 2. Generate │                      │
       │                    │   embedding │                      │
       │                    │────────────▶│ 3. Store with vector │
       │                    │             │                      │
       │  4. Semantic search              │                      │
       │─────────────────────────────────▶│ 5. Vector similarity │
       │                                  │    search            │
       │  6. Live analytics               │                      │
       │─────────────────────────────────▶│ 7. Real-time GROUP BY│
       │                                  │    (HTAP)            │
       │◀─────────────────────────────────│                      │
       │         8. Results               │                      │
└──────────────────────────────────────────────────────────────────┘
  • Vector Search: TiDB stores embeddings as VECTOR(1536) and performs cosine similarity search natively
  • HTAP: Analytics queries run on the same database as writes — no ETL, no data warehouse
  • High Concurrency: TiDB handles concurrent inserts while maintaining consistency
  • MySQL Compatible: Standard SQL syntax with vector extensions

Why TiDB vs. Alternatives?

RequirementPostgreSQL + pgvectorPinecone + PostgreSQLTiDB Cloud Zero
Vector search✅ Extension needed✅ Separate service✅ Built-in
Real-time analytics⚠️ Slows with scale❌ Separate DB✅ Native HTAP
Horizontal scale❌ Complex sharding⚠️ Two systems✅ Automatic
Setup complexityMediumHigh (2 services)Zero

Important Notes

  • No authentication required — TiDB Cloud Zero API is free and open
  • Instances auto-expire in 30 days — claim yours to keep it permanently
  • Always use TLS when connecting
  • OpenAI costs — embeddings use the affordable text-embedding-3-small model

Claiming Your Database (Persistence)

Your database expires in 30 days. To keep it permanently:

  1. Open the Claim URL from your tidb_info.md file
  2. Sign up or log into TiDB Cloud
  3. Your database migrates to your account with persistent access

Checking Your Database in the TiDB Dashboard

After claiming your instance, you can inspect your data directly in the TiDB Cloud dashboard:

  1. Log into TiDB Cloud and open your claimed cluster
  2. In the left sidebar, open SQL Editor
  3. Use the Schemas pane to browse your databases and tables—you'll see the feedback table with columns: id, name, message, sentiment, embedding, and created_at
  4. Run queries or browse the data in the Result view to verify your Pulse app's feedback entries
TiDB Cloud SQL Editor showing feedback table

Next Steps

  • Deploy to Streamlit Cloud — free hosting for your Pulse app
  • Add authentication — track feedback by user with Streamlit session state
  • Advanced analytics — add time-series charts showing feedback trends
  • Multi-language support — TiDB handles Unicode natively for global feedback